/*
2021-7-17
https://www.acwing.com/problem/content/3774/
*/

#include<cstring>
#include<iostream>
#include<algorithm>
#include<unordered_map>

using namespace std;
typedef long long ll;


int main()
{
    int n;
    cin>>n;
    unordered_map<int,ll> s;
    
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        s[x-i]+=x;
    }
    
    ll res=0;
    
    for(auto &[k,v]:s)  res=max(res,v);
    cout<<res<<endl;
    
    return 0;
}
